﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace AnimatedSprites
{
    class EndManager : MenuManager
    {
        public EndManager(Game1 game)
            : base(game)
        {
            // TODO: Construct any child components here
            optionNumber = 3;
            addButtonname("Images//button_restart"); 
            addButtonname("Images//button_next");
            addButtonname("Images//button_menu");
            addButtonname("Images//button_esc");
        }
        //重写update（）
        public override void Update(GameTime gameTime)
        {
            //检测用户上下按钮输入，更新currentOption的值,如果检测到enter，通过game1掉用其中的currentGameState；
            KeyboardState keyboardState = Keyboard.GetState();
            if (keyboardState.IsKeyDown(Keys.Enter))
                switch (currentOption)
                {
                    case 0: if(game1.win==true)   game1.setState(1);      // next
                            else            game1.setState(1);      // restart
                            break;
                    case 1: game1.setState(0); break;       // main menu
                    case 2: game1.setState(5); break;       // exit
                }
            base.Update(gameTime);
        }
    }
}
